<!DOCTYPE html>

<html class="no-js">

<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <title></title>
  <meta name="description" content="" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />

  <script src="https://cdn.staticfile.org/axios/0.19.0-beta.1/axios.js"></script>

  <script src="../../cdn/vue/vue.global.min.js"></script>
  <link rel="stylesheet" href="../../cdn/element-plus/index.css" />
  <script src="../../cdn/element-plus/index.full.min.js"></script>
  <link rel="stylesheet" href="../../../lib/index.css" />
  <script src="../../../lib/avue.js"></script>
</head>

<body>
  <div id="app">
    {{search}}
    <avue-crud ref="crud" @search-icon-click="searchIconClick" v-model:page="page" v-model:search="search"
      :option="option" :data="data" @search-change="searchChange">
      <template #header>
        <el-tag>头部</el-tag>
      </template>

      <template #search-menu="{size,row}">
        <el-button :size="size">测试</el-button>
      </template>
      <template #checkbox-search="scope">
        <span>123456</span>
      </template>
      <template #checkbox-form="scope">
        <span> 123456</span>
      </template>
      <template #footer>
        <el-tag>尾部</el-tag>
      </template>
      <template #page>
        <el-tag>分页</el-tag>
      </template>
    </avue-crud>
  </div>
</body>
<script>
  var app = Vue.createApp({
    data() {
      return {
        page: {
          pageSize: 20,
          pageSizes: [20, 100, 150, 200],
          total: 40
        },
        search: {},
        option: {
          index: true,
          // searchShow: false,
          searchIcon: true,
          searchMenuSpan: 6,
          height: 'auto',
          calcHeight: 20,
          emptyText: '自定义暂无数据提示语',
          column: [{
            label: '姓名',
            prop: 'name',
          }, {
            label: '多选',
            prop: 'checkbox',
            type: 'checkbox',
            search: true,
            dicData: [{
              label: 1,
              value: 1
            }, {
              label: 2,
              value: 2
            }],
          }, {
            label: '年龄',
            prop: 'sex',
            searchValue: 123,
            searchLabel: "年纪",
            search: true,
            searchRules: [
              {
                required: true,
                message: '请输入年龄',
                trigger: 'blur'
              }
            ]
          }, {
            label: '日期',
            prop: 'datetime',
            type: 'datetime',
            search: true,
            rules: [
              {
                required: true,
                message: '请选择省份',
                trigger: 'blur'
              }
            ],
          }, {
            label: '测试',
            prop: 'test',
            search: true
          }, {
            label: '字典',
            prop: 'dic',
            type: 'select',
            search: true,
            props: {
              label: 'name',
              value: 'code'
            },
            dicUrl: 'https://cli.avuejs.com/api/area/getProvince',
          }]
        },
        data: [{
          name: '1'
        }, {
          name: '2'
        }]
      }
    },
    methods: {
      searchIconClick(flag) {
        console.log(flag)
      },
      searchChange(params, done) {
        done()
        console.log(params);
      }
    }
  })
  app.use(ElementPlus)
  app.use(AVUE)
  app.mount('#app')
</script>

</html>